package com.apes.report.ext;

import com.bstek.ureport.definition.datasource.BuildinDatasource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author cxm
 * @since 2019年3月26日
 */
@Component
public class ReportBuildDatasource implements BuildinDatasource {

//    @Autowired
//    Connector connector;

    @Autowired
    DataSource dataSource;

    @Override
    public String name(){
        return "内置数据源";
    }

    @Override
    public Connection getConnection() {
        try {
            return dataSource.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return  null;
    }

}
